Medium LL ✔
- Middle of LL
- For even number of item, middle is the first item of last part
- Reverse LL - Iterative
- Bruteforce uses single stack
- Iterative uses three pointer(
prev,next,current)
- Reverse LL - Recursive
- 31 March, 2026: 00.26.54 ❌
- Iterating to the last node and pointing
head->next = headcreate a cycle - Ierate to the second last node, so that
head->next(last node) can pointheadsecond last node
1 2 3 4 5
2 2 2 2 2
3 3 3 3 3
4 4 4 4
5 5 5 5
head = 4
head->next = 5
head->next->next = 5->4
head->next = 4->NULL
head = 3
head->next = 4
head->next->next = 4->3
head->next = 3->NULL - Iterating to the last node and pointing
- 31 March, 2026: 00.26.54 ❌
- Detect Loop
- Begin of Loop
- 30 March, 2026: 00.12.52 ✔
- In Loop condition use
fast && fast->next - If
slowandfastare not equal, loop not found, begining isNULL - The iteration to find begining will run untill
slowandfastare equal. headto begining node is equal ton*i+/-k- Return node will be slow/fast
- In Loop condition use
- 30 March, 2026: 00.12.52 ✔
- Length of Loop
- 30 March, 2026: 00.10.57 ✔
- After loop detection both pointer point to same node, move one to next
- Intialize counter with
1as the current one will not consider in the loop
- 30 March, 2026: 00.10.57 ✔
- Pallindrome
- Segrregate odd and even
- 31 March, 2026: 00.18.34 ❌
- Failed at implmentation
- Whatever is assigned to
current->next,currentusually becomes that valuecurrent->next = odd;
current = odd;
- Whatever is assigned to
- Failed at implmentation
- 31 March, 2026: 00.18.34 ❌
- Remove Nth node from the back
- Delete Middle Node
- Optimization done with only TortoiseHare method with extra pointer with
NULLvalue - Use a
NULLpointer approach to remove any type of remove operation
- Optimization done with only TortoiseHare method with extra pointer with
- Sort LL
- 31 March, 2026: 00.23.41 ❌
- Failed at implmentation
- Recursive call based on mid
- Merge two part of the list
- 31 March, 2026: 00.23.41 ❌
- Sort a LL of 0's 1's and 2's by changing links
- 31 March, 2026: 00.16.54 ❌
- Failed at implementation
- No need merge sort or DNF
- Consider the case if there is no
0or1
- 31 March, 2026: 00.16.54 ❌
- Intersection
- 31 March, 2026: 00.16.54 ❌
- Failed at optimization
- Check the same way, but in time complexity, if you found
NULLduring traversing any list, reassign thecurrentpointer again as head. - Try to solve it with help of it's length
- 31 March, 2026: 00.16.54 ❌
- Add 1 to a number represented by LL
- Keep reverse function seperate
- Add 2 numbers in LL
- List should be in reverse order